home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Applications / gdbm-1.7.3 / source / gdbmerrno.c < prev    next >
Text File  |  1994-05-21  |  2KB  |  63 lines

  1. /* gdbmerrno.c - convert gdbm errors into english. */
  2.  
  3. /*  This file is part of GDBM, the GNU data base manager, by Philip A. Nelson.
  4.     Copyright (C) 1993  Free Software Foundation, Inc.
  5.  
  6.     GDBM is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation; either version 2, or (at your option)
  9.     any later version.
  10.  
  11.     GDBM is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.     GNU General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU General Public License
  17.     along with GDBM; see the file COPYING.  If not, write to
  18.     the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20.     You may contact the original author by:
  21.        e-mail:  phil@cs.wwu.edu
  22.       us-mail:  Philip A. Nelson
  23.                 Computer Science Department
  24.                 Western Washington University
  25.                 Bellingham, WA 98226
  26.        
  27.     The author of this file is:
  28.        e-mail:  downsj@csos.orst.edu
  29.  
  30. *************************************************************************/
  31.  
  32.  
  33. /* include system configuration before all else. */
  34. #include "autoconf.h"
  35.  
  36. #include "gdbmerrno.h"
  37.  
  38. /* this is not static so that applications may access the array if they
  39.    like. it must be in the same order as the error codes! */
  40.  
  41. const char * const gdbm_errlist[] = {
  42.   "No error", "Malloc error", "Block size error", "File open error",
  43.   "File write error", "File seek error", "File read error",
  44.   "Bad magic number", "Empty database", "Can't be reader", "Can't be writer",
  45.   "Reader can't delete", "Reader can't store", "Reader can't reorganize",
  46.   "Unknown update", "Item not found", "Reorganize failed", "Cannot replace",
  47.   "Illegal data", "Option already set", "Illegal option"
  48. };
  49.  
  50. const char *
  51. gdbm_strerror(error)
  52.     gdbm_error error;
  53. {
  54.   if(((int)error < 0) || ((int)error > 18))
  55.     {
  56.       return("Unkown error");
  57.     }
  58.   else
  59.     {
  60.       return(gdbm_errlist[(int)error]);
  61.     }
  62. }
  63.